package com.management.service.Impl;

import com.management.dao.UserAndCompanyDao;
import com.management.po.UserAndCompany;
import com.management.service.UserAndCompanyService;
import com.management.vo.UserAndCompanyVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zwh
 * @date 2021/10/29
 */
@Service
public class UserAndCompanyServiceImpl implements UserAndCompanyService {
    @Autowired
    UserAndCompanyDao userAndCompanyDao;

    @Override
    public List<UserAndCompanyVO> findAll() {
        List<UserAndCompanyVO> list = userAndCompanyDao.findAll();
        return list;
    }

    @Override
    public UserAndCompanyVO findByUserAndCompanyId(int userAndCompanyId) {
        return userAndCompanyDao.findByUserAndCompanyId(userAndCompanyId);
    }

    @Override
    public List<UserAndCompanyVO> findByUserId(int userId) {
        List<UserAndCompanyVO> list = userAndCompanyDao.findByUserId(userId);
        return list;
    }

    @Override
    public List<UserAndCompanyVO> findByCompanyId(int companyId) {
        List<UserAndCompanyVO> list = userAndCompanyDao.findByCompanyId(companyId);
        return list;
    }

    @Override
    public List<UserAndCompanyVO> findByDeptId(int deptId) {
        List<UserAndCompanyVO> list = userAndCompanyDao.findByDeptId(deptId);
        return list;
    }

    @Override
    public List<UserAndCompanyVO> findByCompanyAndSectionId(int companyId, int sectionId) {
        List<UserAndCompanyVO> list = userAndCompanyDao.findByCompanyAndSectionId(companyId,sectionId);
        return list;
    }

    @Override
    public List<UserAndCompanyVO> findByCompanyAndPostId(int companyId, int postId) {
        List<UserAndCompanyVO> list = userAndCompanyDao.findByCompanyAndPostId(companyId,postId);
        return list;
    }

    @Override
    public List<UserAndCompanyVO> find(UserAndCompany userAndCompany) {

        return null;
    }

    @Override
    public boolean add(UserAndCompany userAndCompany) {
        return userAndCompanyDao.add(userAndCompany)>0?true:false;
    }

    @Override
    public boolean update(UserAndCompany userAndCompany) {
        return userAndCompanyDao.update(userAndCompany)>0?true:false;
    }
}
